package com.ceshiren.springstudy.controller;

import com.ceshiren.springstudy.dao.UserDao;
import com.ceshiren.springstudy.dto.TestUser;
import com.ceshiren.springstudy.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    UserDao userDao;

    @GetMapping("/findAll")
    public Result findAll(){
        List<TestUser> testUserList = userDao.findAll();
        return Result.success().data(testUserList);
    }
}
